package com.example.autopia.view.Activities

import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import com.example.autopia.R
import com.example.autopia.databinding.ActivityHelpBinding

class HelpActivity : AppCompatActivity() {
    private lateinit var binding: ActivityHelpBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityHelpBinding.inflate(layoutInflater)
        setContentView(binding.root)

        binding.btBack.setOnClickListener {
            finish()
        }

        binding.llTelegram1.setOnClickListener {
            copyTextToClipboard("@Skyain")

        }

        binding.llTelegram2.setOnClickListener {
            copyTextToClipboard("@nataliiabul")

        }
    }

    private fun copyTextToClipboard(text: String) {
        Log.d("Clipboard", "Copying text: $text")

        val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
        val clip = ClipData.newPlainText("Text", text)
        clipboard.setPrimaryClip(clip)

        Toast.makeText(this@HelpActivity, "Текст скопирован в буфер обмена", Toast.LENGTH_SHORT).show()
    }
}